import { SET_TOKEN, SET_USERINFO,SET_MENULIST, SET_ROLELIST} from './types'

export function tokenAct(token) {
    return {type: SET_TOKEN, token}
}

export  function userinfoAct(userInfo){
      return {type:SET_USERINFO,userInfo}
}


export  function  menulistAct (menuList){
         return {   type:  SET_MENULIST ,menuList  }
}

export  const   roleListAct = roleList =>({type:SET_ROLELIST,roleList})
/* export function userinfoAct() {
    return async dispatch => {
      
        let userInfo = await asyncFunc()
        dispatch({type: SET_USERINFO, userInfo})
    }
} */

function asyncFunc() {
    return new Promise(resolve => {
        console.log('------------------ promise start');
        setTimeout(() => {
            console.log('------------------ promise end');
            resolve({id: 'admin', name: '超级管理员'})
        }, 1500)
    })
}